#NoEnv  ; Recommended for performance and compatibility with future AutoHotkey releases.
;SendMode Input  ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir%  ; Ensures a consistent starting directory.
#MaxThreadsPerHotkey 2
~`:: Autorun()
~XButton1::AltR()
~XButton2:: AltJ()
F11:: turnShitIn()
F12:: spamClick()
Pause::Pause

SetKeyDelay, -1, 0
SetMouseDelay, -1



spamClick(){
    SetMouseDelay, -1
    Global Toggle1 := !Toggle1
     While Toggle1{
		MouseClick, right
	}
}
	
	
	
turnShitIn(){
	SetMouseDelay, -1
	Global Toggle2 := !Toggle2
	While Toggle2{
		MouseClick, left, 192, 460
		MouseClick, left, 223, 633
		MouseClick, left, 523, 621
	}
}
	



AltJ(){
	if (WinActive("Atlantica")) {
	send, !J
	}	
}

AltR(){
	if (WinActive("Atlantica")) {
	send, !R
	}
}

AutoRun(){
	send, {NumLock}
	;SetNumlockState, on
}

Rezz(){
	revivex:=0
	WinGetActiveStats, Title, ScreenWidth, ScreenHeight, posix, posiy
	send, {space}
	sleep, 100
	ImageSearch, lifepotionx, lifepotiony, 0, 0, ScreenWidth, ScreenHeight, lifepotion.png
	if (ErrorLevel=0) {
		MouseClick, right, lifepotionx, lifepotiony
		}
	send, {space}
	sleep, 300
	ImageSearch, revivex, revivey, 250, 250, ScreenWidth-300, ScreenHeight-200, *16 reviver.png
	ImageSearch, revivetodosx, revivetodosy, 250, 250, ScreenWidth-300, ScreenHeight-200, *16 revivertodos.png
		
	if (revivex>0 || revivetodosx>0) {
		now:=A_now
		elapsed:=0
		while (elapsed<2){
			sleep, 10
			EnvSub, elapsed, now, seconds
			if (revivex>0) { 
				MouseClick, left, revivex, revivey
				now:=A_now
				sleep, 500
			}
			if (revivetodosx>0){
				MouseClick, left, (revivetodosx+139), (revivetodosy-154)
				now:=A_now
				sleep, 500
			}
			ImageSearch, revivex, revivey, 250, 250, ScreenWidth-300, ScreenHeight-200, *16 reviver.png
			ImageSearch, revivetodosx, revivetodosy, 250, 250, ScreenWidth-300, ScreenHeight-200, *16 revivertodos.png
			}
	}
}